package com.jake.sort.dao;

import com.jake.sort.constant.Limits;
import com.jake.sort.utils.RandomUtils;
import com.jake.sort.vo.Cat;
import com.jake.sort.vo.Countable;
import com.jake.sort.vo.Dog;
import com.jake.sort.vo.Person;

import java.util.ArrayList;
import java.util.List;

/**
 * 模仿从数据库做持久化操作的Dao层
 */
public class VOListsDao {

    public List<Countable> getPersons() {
        List<Countable> persons = new ArrayList<>();

        for (int i = 0; i < Limits.MAX_SIZE; i++) {
            Person person = new Person();
            person.setPid(i + 1);
            person.setAge(RandomUtils.getHumanAge());
            person.setHeight(RandomUtils.getHumanHeight());
            person.setWeight(RandomUtils.getHumanWeight());
            persons.add(person);
        }
        
        return persons;
    }

    public List<Countable> getCats() {
        List<Countable> cats = new ArrayList<>();

        for (int i = 0; i < Limits.MAX_SIZE; i++) {
            Cat cat = new Cat();
            cat.setCid(i + 1);
            cat.setAge(RandomUtils.getPetAge());
            cat.setHeight(RandomUtils.getPetHeight());
            cat.setWeight(RandomUtils.getPetWeight());
            cats.add(cat);
        }

        return cats;
    }

    public List<Countable> getDogs() {
        List<Countable> dogs = new ArrayList<>();

        for (int i = 0; i < Limits.MAX_SIZE; i++) {
            Dog dog = new Dog();
            dog.setDid(i + 1);
            dog.setAge(RandomUtils.getPetAge());
            dog.setHeight(RandomUtils.getPetHeight());
            dog.setWeight(RandomUtils.getPetWeight());
            dogs.add(dog);
        }

        return dogs;
    }

}
